﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Linq;

namespace SignalBox.Core.Data
{
    public class LayoutInfo
    {
        public int SizeX
        {
            get;
            set;
        }

        public int SizeY
        {
            get;
            set;
        }

        public string Name
        {
            get;
            set;
        }

        public string Author
        {
            get;
            set;
        }

        public string Description
        {
            get;
            set;
        }

        public XElement ToXml()
        {
            return new XElement("LayoutInfo",
                                new XElement("SizeX", SizeX),
                                new XElement("SizeY", SizeY),
                                new XElement("Name", Name),
                                new XElement("Author", Author),
                                new XElement("Description", Description));
        }

        public void FromXml(XElement layoutInfo)
        {
            SizeX = Int32.Parse(layoutInfo.Element("SizeX").Value);
            SizeY = Int32.Parse(layoutInfo.Element("SizeY").Value);
            Name = layoutInfo.Element("Name").Value;
            Author = layoutInfo.Element("Author").Value;
            Description = layoutInfo.Element("Description").Value;
        }

    }
}
